package cn.edu.scut.sys.vo;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * Unit entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "unit", catalog = "scoredb")
@JsonIgnoreProperties(value={"hibernateLazyInitializer"})
public class Unit implements java.io.Serializable {
	
	private static final long serialVersionUID = 7251268642498841604L;

	// Fields

	private Long id;
	private Leader leader;
	private Unit unit;
	private String name;
	private Integer type;

	// Constructors
	
	@Column(name = "type")
	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	/** default constructor */
	public Unit() {
	}

	/** full constructor */
	public Unit(Leader leader, Unit unit, String name) {
		this.leader = leader;
		this.unit = unit;
		this.name = name;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "leaderId")
	public Leader getLeader() {
		return this.leader;
	}

	public void setLeader(Leader leader) {
		this.leader = leader;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "unitId")
	public Unit getUnit() {
		return this.unit;
	}

	public void setUnit(Unit unit) {
		this.unit = unit;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

}